﻿using System.Collections.Specialized;

namespace STeaL.Collections.Specialized {
  public static class CollectionChangedExtensions {
#region Notify
    public static void Notify(this NotifyCollectionChangedEventHandler handler, object sender, NotifyCollectionChangedAction action, object item, int index) {
      if ( handler != null ) handler(sender, new NotifyCollectionChangedEventArgs(action,item,index));
    }

#endregion
#region NotifyAdd
    public static void NotifyAdd(this NotifyCollectionChangedEventHandler handler, object sender, object item, int index) {
      if ( handler != null ) handler(sender, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,item,index));
    }

#endregion
#region NotifyReplace
    public static void NotifyReplace(this NotifyCollectionChangedEventHandler handler, object sender, object item, int index) {
      if ( handler != null ) handler(sender, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace,item,index));
    }

#endregion
#region NotifyRemove
    public static void NotifyRemove(this NotifyCollectionChangedEventHandler handler, object sender, object item) {
      if ( handler != null ) handler(sender, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,item));
    }

#endregion
#region NotifyReset
    public static void NotifyReset(this NotifyCollectionChangedEventHandler handler, object sender) {
      if ( handler != null ) handler(sender, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
    }

#endregion
  }
}
